import router from './router'
import { getToken } from '@/utils/token'
router.beforeEach((to, from, next) => {
  // 获取token
  const token = getToken()
  // 非登录，还没token，跳转登录页面
  if (token) {
    next()
  } else {
    if (to.path === '/login') {
      next()
    } else {
      next('/login')
    }
  }
})
